-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #100: Add purge support #104
Conversation
cd8e78e
to
58fc04a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think displaying this as a "discard" feature will result in accidentally deleted files. See inline comments.
@@ -23,6 +23,9 @@ | |||
"command.update": "Update to...", | |||
"command.branch": "Create Branch...", | |||
"command.pull": "Pull", | |||
"command.purge": "Purge", | |||
"command.purgeFiles": "Purge All Untracked Files", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between "Purge" and "Purge All Untracked Files"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purge is for the individual file, and Purge all untracked is for the whole untracked files source group.
This allow the user to have a fine grain control on the Untracked Source Group view.
package.json
Outdated
"command": "hg.purgeFiles", | ||
"title": "%command.purgeFiles%", | ||
"category": "Hg", | ||
"icon": "$(discard)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
purge
is very different from discarding changes. If I saw this in the hg extension, I would assume it discards changes, and would be frustrated if it deleted my untracked files. This should not use the discard icon, because that icon implies reverting changes rather than deleting files. I don't think this command is used frequently enough to warrant a top-level icon in the SCM pane. It should just be a command in the command palette.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git extension uses the discard icon for untracked files, and it is really useful to be able to purge the files from the SCM view.
The tool also asks the user for confirmation, informing this is irreversible.
Also, the user has to enable purge extension for this to work, so they know what they are doing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the git extension uses the discard icon because it doesn't have a separate group for Untracked files, so it has to be consistent with the other files.
In our case we should use the trash icon instead. I believe this will be informing enough to the user that this action deletes files.
Icon reference: https://code.visualstudio.com/api/references/icons-in-labels
|
||
@command('hg.purge') | ||
async purge(...resourceStates: SourceControlResourceState[]): Promise<void> { | ||
if (resourceStates.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should there be an option to purge specific files? Selecting specific files to send to the purge
command is the same thing as selecting specific files and then deleting them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Currently there is no way of deleting untracked files from the SCM tab, so this is what I am implementing.
Thanks for the demo. Looks great. |
Thanks for making these changes. I saw after I made the notes that the git extension does indeed use the discard icon. This is better, though. :) |
Yeah, it does look better with the trash icon, and I wouldn't have found it without your review! Thanks! |
The code does not check if the extension is enabled.
Instead it shows an error when tried to run the command and the extension is missing.